package com.example.demo.factory.version3_factory;


import com.example.demo.factory.version2_多态.Operation;

import java.util.Scanner;

/**
 * @author keyer
 * @Description : 描述
 * Created by cyd on 2021-05-24 14:04:20
 */
public class Calculator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入数字A");
        double numberA = scanner.nextDouble();
        System.out.println("请输入数字B");
        double numberB = scanner.nextDouble();
        System.out.println("请输入操作符");
        String operate = scanner.next();


        Operation operation = OperationFactory.createOperation(operate);
        operation.setNumberA(numberA);
        operation.setNumberB(numberB);
        double result = operation.getResult();

        System.out.println("结果为:" + result);
    }
}
